﻿#!perl
use strict;
use warnings;
use Parse;
use JsDoc;

new JsDoc file=>'..\\dollar.js', doc_dir=>'doc';

=dis
my $remark = <<'REMARK';
/**
 * @author baboo
 * @description
 *  this is description
 *  line 1
 *  line 2
 *  line 3@a
 * @example
*/
REMARK

my ($description)  = $remark =~ m'@description(.+?)(?=\n\s\*\s@|\*/)'si;
    $description =~ s/^:|^\s+\*//mg if $description;
my $undef;
if ($undef) {print 'ok'};
print $description;
#use encoding 'UTF-8', STDIN =>'UTF-8', STDOUT =>'UTF-8';
=dis
new JsDoc '../dollar.js';
exit;
open FH, '<:encoding(utf-8)', '../dollar.js';
my @jscode = <FH>;
close FH;


my $js_parse = new Parse ("javascript", <<JSCODE);
    var a = function() {
        var first_arg = arguments[0];
        return first_arg;
    }   

    var b = a();
JSCODE


my $start = times;
my $js_parse = new Parse("javascript", join('', @jscode));
my $end = times;
print $end - $start;
#=dis
open STDOUT, '>:encoding(utf-8)', 'dollar.html';

print <<HTML_START;
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>JSCODE</title>
<style>
li{border-bottom:1px dashed #ccc;line-height:25px}
li b{font-weight:normal}
HTML_START

for my $keytype (keys %{$IdItem::Colors}) {
    print '.c' . $keytype . '{color:' . $IdItem::Colors->{$keytype} . '}';
}

print <<HTML_START;
</style>
</head>
<body>
HTML_START

print $js_parse->to_html();

print <<HTML_END;
</body>
</html>
HTML_END
close STDOUT;
#my $js_parse = new Parse("javascript", join('', @jscode));
#$js_parse->dump();
#=cut

